package com.gcl.singleton;

import java.util.Vector;

public class SingletonTest2 {
	/**
	 * 持有私有静态实例，防止被引用，此处赋值为null
	 * 目的是实现延迟加载
	 */
	private static SingletonTest2 instance = null;
	private Vector properties = null;
	
	
	public Vector getProperties() {
		return properties;
	}
	//私有构造方法，防止被实例化
	private SingletonTest2(){
		
	}
	private static synchronized void syncInit(){
		if(instance == null){
			instance = new SingletonTest2();
		}
	}

	//静态工程方法，创建实例
	public static SingletonTest2 getInstance() {
		if(instance==null){
			syncInit();
		}
		return instance;
	}
	
	public void updateProperties(){
		SingletonTest2 shadow = new SingletonTest2();
		properties = shadow.getProperties();
	}
}
